A Perl script and a Perl module are using `use lib` and referencing the same module

Posted by miss_a on Stack Overflow See other posts from Stack Overflow or by miss_a
Published on 2014-08-22T15:41:33Z Indexed on 2014/08/22 16:21 UTC
Read the original article Hit count: 276

Filed under:

I have a Perl script that is using two modules. The first module also uses the second module.

If the the first module does use lib 'dir1', and the script does use lib 'dir2':

module1.pm

use lib "dir1";
use module2;

script.pl

use lib "dir2";
use module1;
use module2;

which directory is being used by the first module? Does the script's use lib, 'dir2' override the use lib, 'dir1' in the first module, or do they have different scope?

© Stack Overflow or respective owner

Related posts about perl